package gui.panels;

import java.awt.BorderLayout;
import java.awt.Font;

import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.text.DefaultCaret;

public class LogsArea extends JPanel {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1153642255023597323L;
	private JTextArea txtrLogs;
	
	public LogsArea() {
		setLayout(new BorderLayout());
		setBorder(BorderFactory.createTitledBorder("Logs"));
		txtrLogs = new JTextArea();
		txtrLogs.setEditable(false);
		DefaultCaret caret = (DefaultCaret)txtrLogs.getCaret();
		caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
		txtrLogs.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 12));
		JScrollPane scrollPane = new JScrollPane(txtrLogs);
		add(scrollPane);
	}
	
	public void append(final String message) {
		txtrLogs.append(message);
	}

}
